<template>
	<view class="auditor">
		<navBar :titleText="titleText"></navBar>
		<view class="auditor-mian">
			<none v-if="sudioList.length==0"></none>
			<view v-else class="auditorList" v-for="(item,index) in sudioList" :key="index">
				<view class="avatarImg">
					<image :src="item.avatar" mode=""></image>
				</view>
				<view class="userinfo">
					<view class="userinfo-title">{{item.name}} {{item.sex=='1'?"男":"女"}} {{item.telphone}}</view>
					<view class="userinfo-address">{{item.province}}{{item.city}}{{item.county}}</view>
				</view>
				<view class="userinfo-type refuse" v-if="titleText.includes('申请')">拒绝</view>
				<view class="userinfo-type" :class="item.audiotorType=='冻结'||item.audiotorType=='删除'?'redback':'greenback'">{{item.audiotorType}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import navBar from "@/component/count/navBar.vue"
	import $http from "@/component/commen/api/request.js"
	import none from "@/otherPages/none/none.vue"
	export default {
		components:{navBar,none},
		data() {
			return {
				titleText:"",//navbar标题
				sudioList:[],//列表数据
			};
		},
		onLoad(e) {
			this.titleText = e.title
			console.log("标题",this.titleText)
		},
		onShow() {
			// console.log("标题",this.titleText)
			this.getauditorDetail()
		},
		methods:{
			getauditorDetail(){//获取数据
				console.log(this.titleText.includes("回收员"))
				let isfreeze = 1
				console.log(this.titleText.includes("申请"))
				if(this.titleText.includes("回收员")&&!this.titleText.includes("申请")){
					console.log("执行啦")
					console.log(this.titleText)
					if(this.titleText.includes("解冻")){
						console.log("解冻")
						isfreeze = 2
						$http({
							url:`?i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=admin&op=collectorCheckList&m=wjyk_recycle&sign=54182e099baf62c983e0175479034bd6`,
							method:"get",
							data:{
								freeze_status:isfreeze
							}
						}).then(res=>{
							if(res.errno!=0){
								return uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							this.sudioList = res.data.list
							this.sudioList.forEach(item=>{
								item.audiotorType = "解冻"
							})
						})
					}else{
						console.log("不是解冻")
						$http({
							url:`?i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=admin&op=collectorList&m=wjyk_recycle&sign=afaf8a6cc34e2b31359558b9413a68b3`,
							method:"get",
							data:{
								freeze_status:isfreeze
							}
						}).then(res=>{
							if(res.errno!=0){
								return uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							this.sudioList = res.data.list
							if(this.titleText.includes("充值")){
								this.sudioList.forEach(item=>{
									item.audiotorType = "充值"
								})
							}else if(this.titleText.includes("冻结")){
								this.sudioList.forEach(item=>{
									item.audiotorType = "冻结"
								})
							}else if(this.titleText.includes("删除")){
								this.sudioList.forEach(item=>{
									item.audiotorType = "删除"
								})
							}
						})
					}
				}else if(!this.titleText.includes("申请")){
					if(this.titleText.includes("解冻")){
						console.log("合伙人解冻")
						isfreeze = 2
						$http({
							url:`i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=admin&op=partnerList&m=wjyk_recycle&sign=5a25acd5f36cccb5c8095039d883944c`,
							method:"get",
							data:{
								freeze_status:isfreeze
							}
						}).then(res=>{
							if(res.errno!=0){
								return uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							this.sudioList = res.data.list
							this.sudioList.forEach(item=>{
								item.audiotorType = "解冻"
							})
						})
					}else{
						console.log("不是解冻")
						$http({
							url:`?i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=admin&op=partnerList&m=wjyk_recycle&sign=c04c94f141503eea1743b32280162569`,
							method:"get",
							data:{
								freeze_status:isfreeze
							}
						}).then(res=>{
							if(res.errno!=0){
								return uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							this.sudioList = res.data.list
							if(this.titleText.includes("充值")){
								this.sudioList.forEach(item=>{
									item.audiotorType = "充值"
								})
							}else if(this.titleText.includes("冻结")){
								this.sudioList.forEach(item=>{
									item.audiotorType = "冻结"
								})
							}else if(this.titleText.includes("删除")){
								this.sudioList.forEach(item=>{
									item.audiotorType = "删除"
								})
							}
						})
					}
				}
				else if(this.titleText.includes("申请")){
					if(this.titleText.includes("回收员")){
						console.log("回收员申请列表")
						$http({
							url:`?i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=admin&op=collectorCheckList&m=wjyk_recycle&sign=54182e099baf62c983e0175479034bd6`,
							method:"get"
						}).then(res=>{
							console.log(res)
							if(res.errno!=0){
								return uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							this.sudioList = res.data.list
							this.sudioList.forEach(item=>{
								item.audiotorType = "同意"
							})
						})
					}else if(this.titleText.includes("合伙人")){
						$http({
							url:`?i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=admin&op=partnerCheckList&m=wjyk_recycle&sign=7dea0ff796b1d38c6914d222a5bd50cf`,
							method:"get"
						}).then(res=>{
							if(res.errno!=0){
								return uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							this.sudioList = res.data.list
							this.sudioList.forEach(item=>{
								item.audiotorType = "同意"
							})
						})
					}
				}
			}
		},
	}
</script>

<style lang="scss" scoped>
.auditor{
	.auditor-mian{
		padding: 0 20rpx;
		box-sizing: border-box;
		padding-top: 150rpx;//150:navbar高度
		.auditorList{
			background: #fff;
			padding: 20rpx 30rpx;
			box-sizing: border-box;
			border-radius: 10rpx;
			display: flex;
			margin-top: 20rpx;
			.avatarImg{
				width: 86rpx;
				height: 86rpx;
				margin-right: 20rpx;
				border-radius: 50%;
				background: #009b4d;
				image{
					width:100%;
					height: 100%;
					border-radius: 50%;
				}
			}
			.userinfo{
				.userinfo-title{
					font-size: 31rpx;
					font-weight: bold;
				}
				
			}
			.userinfo-type{
				// padding: 8rpx 10rpx;
				width: 100rpx;
				height: 40rpx;
				text-align: center;
				color: #fff;
				border-radius: 24rpx;
				margin-left: auto;
			}
			.refuse{
				background: #eeeeef;
				color: #f00;
				margin-right: 5rpx;
			}
			.redback{
				background: #ff8a23;
			}
			.greenback{
				background:#009b4d ;
			}
			
		}
	}
}
</style>
